home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Soundtracker Soundsystem.adf / sources / replay.s < prev   
Text File  |  1988-03-09  |  6KB  |  383 lines

  1. ; -----------------------------------------------------
  2. ; ------- D.O.C SoundTracker V2.0 - playroutine -------
  3. ; -----------------------------------------------------
  4. ; ---- Improved and omptimized by Unknown of D.O.C ----
  5. ; --------- Based on the playroutine from TJC ---------
  6. ; -----------------------------------------------------
  7.  
  8. mt_init:lea    mt_data(pc),a0
  9.     add.l    #$01d8,a0
  10.     move.l    #$0080,d0
  11.     moveq    #$00,d1
  12. mt_init1:
  13.     move.l    d1,d2
  14.     subq.w    #1,d0
  15. mt_init2:
  16.     move.b    (a0)+,d1
  17.     cmp.b    d2,d1
  18.     bgt.s    mt_init1
  19.     dbf    d0,mt_init2
  20.     addq.b    #1,d2
  21.  
  22. mt_init3:
  23.     lea    mt_data(pc),a0
  24.     lea    mt_sample1(pc),a1
  25.     asl.l    #$08,d2
  26.     asl.l    #$02,d2
  27.     add.l    #$0258,d2
  28.     add.l    a0,d2
  29.     moveq    #$0e,d0
  30. mt_init4:
  31.     move.l    d2,(a1)+
  32.     moveq    #$00,d1
  33.     move.w    42(a0),d1
  34.     asl.l    #1,d1
  35.     add.l    d1,d2
  36.     add.l    #$1e,a0
  37.     dbf    d0,mt_init4
  38.  
  39.     lea    mt_sample1(pc),a0
  40.     moveq    #$00,d0
  41. mt_clear:
  42.     move.l    (a0,d0),a1
  43.     clr.l    (a1)
  44.     addq.l    #4,d0
  45.     cmp.l    #$3c,d0
  46.     bne.s    mt_clear
  47.  
  48.     clr.w    $dff0a8
  49.     clr.w    $dff0b8
  50.     clr.w    $dff0c8
  51.     clr.w    $dff0d8
  52.     clr.l    mt_partnrplay
  53.     clr.l    mt_partnote
  54.     clr.l    mt_partpoint
  55.  
  56.     move.b    mt_data+$1d6,mt_maxpart+1
  57.     rts
  58.  
  59. mt_end:    clr.w    $dff0a8
  60.     clr.w    $dff0b8
  61.     clr.w    $dff0c8
  62.     clr.w    $dff0d8
  63.     move.w    #$000f,$dff096
  64.     rts
  65.  
  66. mt_music:
  67.     addq.l    #1,mt_counter
  68. mt_cool:cmp.l    #6,mt_counter
  69.     bne.s    mt_notsix
  70.     clr.l    mt_counter
  71.     bra    mt_rout2
  72.  
  73. mt_notsix:
  74.     lea    mt_aud1temp(pc),a6
  75.     tst.b    3(a6)
  76.     beq.s    mt_arp1
  77.     lea    $dff0a0,a5        
  78.     bsr.s    mt_arprout
  79. mt_arp1:lea    mt_aud2temp(pc),a6
  80.     tst.b    3(a6)
  81.     beq.s    mt_arp2
  82.     lea    $dff0b0,a5
  83.     bsr.s    mt_arprout
  84. mt_arp2:lea    mt_aud3temp(pc),a6
  85.     tst.b    3(a6)
  86.     beq.s    mt_arp3
  87.     lea    $dff0c0,a5
  88.     bsr.s    mt_arprout
  89. mt_arp3:lea    mt_aud4temp(pc),a6
  90.     tst.b    3(a6)
  91.     beq.s    mt_arp4
  92.     lea    $dff0d0,a5
  93.     bra.s    mt_arprout
  94. mt_arp4:rts
  95.  
  96. mt_arprout:
  97.     move.b    2(a6),d0
  98.     and.b    #$0f,d0
  99.     tst.b    d0
  100.     beq.s    mt_arpegrt
  101.     cmp.b    #1,d0
  102.     beq.s    mt_portup
  103.     cmp.b    #2,d0
  104.     beq.s    mt_portdwn
  105.     rts
  106.  
  107. mt_portup:
  108.     moveq    #$00,d0
  109.     move.b    3(a6),d0
  110.     sub.w    d0,22(a6)
  111.     cmp.w    #$71,22(a6)
  112.     bpl.s    mt_ok1
  113.     move.w    #$71,22(a6)
  114. mt_ok1:    move.w    22(a6),6(a5)
  115.     rts
  116.  
  117. mt_portdwn:
  118.     moveq    #$00,d0
  119.     move.b    3(a6),d0
  120.     add.w    d0,22(a6)
  121.     cmp.w    #$358,22(a6)
  122.     bmi.s    mt_ok2
  123.     move.w    #$358,22(a6)
  124. mt_ok2:    move.w    22(a6),6(a5)
  125.     rts
  126.  
  127. mt_arpegrt:
  128.     cmp.l    #1,mt_counter
  129.     beq.s    mt_loop2
  130.     cmp.l    #2,mt_counter
  131.     beq.s    mt_loop3
  132.     cmp.l    #3,mt_counter
  133.     beq.s    mt_loop4
  134.     cmp.l    #4,mt_counter
  135.     beq.s    mt_loop2
  136.     cmp.l    #5,mt_counter
  137.     beq.s    mt_loop3
  138.     rts
  139.  
  140. mt_loop2:
  141.     moveq    #$00,d0
  142.     move.b    3(a6),d0
  143.     lsr.b    #4,d0
  144.     bra.s    mt_cont
  145. mt_loop3:
  146.     moveq    #$00,d0
  147.     move.b    3(a6),d0
  148.     and.b    #$0f,d0
  149.     bra.s    mt_cont
  150. mt_loop4:
  151.     move.w    16(a6),d2
  152.     bra.s    mt_endpart
  153. mt_cont:
  154.     asl.w    #1,d0
  155.     moveq    #$00,d1
  156.     move.w    16(a6),d1
  157.     lea    mt_arpeggio(pc),a0
  158. mt_loop5:
  159.     move.w    (a0,d0),d2
  160.     cmp.w    (a0),d1
  161.     beq.s    mt_endpart
  162.     addq.l    #2,a0
  163.     bra.s    mt_loop5
  164. mt_endpart:
  165.     move.w    d2,6(a5)
  166.     rts
  167.  
  168. mt_rout2:
  169.     lea    mt_data(pc),a0
  170.     move.l    a0,a3
  171.     add.l    #$0c,a3
  172.     move.l    a0,a2
  173.     add.l    #$1d8,a2
  174.     add.l    #$258,a0
  175.     move.l    mt_partnrplay,d0
  176.     moveq    #$00,d1
  177.     move.b    (a2,d0),d1
  178.     asl.l    #$08,d1
  179.     asl.l    #$02,d1
  180.     add.l    mt_partnote,d1
  181.     move.l    d1,mt_partpoint
  182.     clr.w    mt_dmacon
  183.  
  184.     lea    $dff0a0,a5
  185.     lea    mt_aud1temp(pc),a6
  186.     bsr    mt_playit
  187.     lea    $dff0b0,a5
  188.     lea    mt_aud2temp(pc),a6
  189.     bsr    mt_playit
  190.     lea    $dff0c0,a5
  191.     lea    mt_aud3temp(pc),a6
  192.     bsr    mt_playit
  193.     lea    $dff0d0,a5
  194.     lea    mt_aud4temp(pc),a6
  195.     bsr    mt_playit
  196.     move.w    #$01f4,d0
  197. mt_rls:    dbf    d0,mt_rls
  198.  
  199.     move.w    #$8000,d0
  200.     or.w    mt_dmacon,d0
  201.     move.w    d0,$dff096
  202.  
  203.     lea    mt_aud4temp(pc),a6
  204.     cmp.w    #1,14(a6)
  205.     bne.s    mt_voice3
  206.     move.l    10(a6),$dff0d0
  207.     move.w    #1,$dff0d4
  208. mt_voice3:
  209.     lea    mt_aud3temp(pc),a6
  210.     cmp.w    #1,14(a6)
  211.     bne.s    mt_voice2
  212.     move.l    10(a6),$dff0c0
  213.     move.w    #1,$dff0c4
  214. mt_voice2:
  215.     lea    mt_aud2temp(pc),a6
  216.     cmp.w    #1,14(a6)
  217.     bne.s    mt_voice1
  218.     move.l    10(a6),$dff0b0
  219.     move.w    #1,$dff0b4
  220. mt_voice1:
  221.     lea    mt_aud1temp(pc),a6
  222.     cmp.w    #1,14(a6)
  223.     bne.s    mt_voice0
  224.     move.l    10(a6),$dff0a0
  225.     move.w    #1,$dff0a4
  226. mt_voice0:
  227.     move.l    mt_partnote,d0
  228.     add.l    #$10,d0
  229.     move.l    d0,mt_partnote
  230.     cmp.l    #$400,d0
  231.     bne.s    mt_stop
  232. mt_higher:
  233.     clr.l    mt_partnote
  234.     addq.l    #1,mt_partnrplay
  235.     moveq    #$00,d0
  236.     move.w    mt_maxpart,d0
  237.     move.l    mt_partnrplay,d1
  238.     cmp.l    d0,d1
  239.     bne.s    mt_stop
  240.     clr.l    mt_partnrplay
  241.  
  242. mt_stop:tst.w    mt_status
  243.     beq.s    mt_stop2
  244.     clr.w    mt_status
  245.     bra.s    mt_higher
  246. mt_stop2:
  247.     rts
  248.  
  249. mt_playit:
  250.     move.l    (a0,d1),(a6)
  251.     addq.l    #4,d1
  252.     moveq    #$00,d2
  253.     move.b    2(a6),d2
  254.     and.b    #$f0,d2
  255.     lsr.b    #4,d2
  256.     tst.b    d2
  257.     beq.s    mt_nosamplechange
  258.  
  259.     moveq    #$00,d3
  260.     lea    mt_samples(pc),a1
  261.     move.l    d2,d4
  262.     asl.l    #2,d2
  263.     mulu    #$1e,d4
  264.     move.l    (a1,d2),4(a6)
  265.     move.w    (a3,d4),8(a6)
  266.     move.w    2(a3,d4),18(a6)
  267.     move.w    4(a3,d4),d3
  268.     tst.w    d3
  269.     beq.s    mt_displace
  270.     move.l    4(a6),d2
  271.     add.l    d3,d2
  272.     move.l    d2,4(a6)
  273.     move.l    d2,10(a6)
  274.     move.w    6(a3,d4),8(a6)
  275.     move.w    6(a3,d4),14(a6)
  276.     move.w    18(a6),8(a5)
  277.     bra.s    mt_nosamplechange
  278.  
  279. mt_displace:
  280.     move.l    4(a6),d2
  281.     add.l    d3,d2
  282.     move.l    d2,10(a6)
  283.     move.w    6(a3,d4),14(a6)
  284.     move.w    18(a6),8(a5)
  285. mt_nosamplechange:
  286.     tst.w    (a6)
  287.     beq.s    mt_retrout
  288.     move.w    (a6),16(a6)
  289.     move.w    20(a6),$dff096
  290.     move.l    4(a6),(a5)
  291.     move.w    8(a6),4(a5)
  292.     move.w    (a6),6(a5)
  293.     move.w    20(a6),d0
  294.     or.w    d0,mt_dmacon
  295.  
  296. mt_retrout:
  297.     tst.w    (a6)
  298.     beq.s    mt_nonewper
  299.     move.w    (a6),22(a6)
  300.  
  301. mt_nonewper:
  302.     move.b    2(a6),d0
  303.     and.b    #$0f,d0
  304.     cmp.b    #11,d0
  305.     beq.s    mt_posjmp
  306.     cmp.b    #12,d0
  307.     beq.s    mt_setvol
  308.     cmp.b    #13,d0
  309.     beq.s    mt_break
  310.     cmp.b    #14,d0
  311.     beq.s    mt_setfil
  312.     cmp.b    #15,d0
  313.     beq.s    mt_setspeed
  314.     rts
  315.  
  316. mt_posjmp:
  317.     not.w    mt_status
  318.     moveq    #$00,d0
  319.     move.b    3(a6),d0
  320.     subq.b    #$01,d0
  321.     move.l    d0,mt_partnrplay
  322.     rts
  323.  
  324. mt_setvol:
  325.     move.b    3(a6),8(a5)
  326.     rts
  327.  
  328. mt_break:
  329.     not.w    mt_status
  330.     rts
  331.  
  332. mt_setfil:
  333.     moveq    #$00,d0
  334.     move.b    3(a6),d0
  335.     and.b    #$01,d0
  336.     rol.b    #$01,d0
  337.     and.b    #$fd,$bfe001
  338.     or.b    d0,$bfe001
  339.     rts
  340.  
  341. mt_setspeed:
  342.     move.b    3(a6),d0
  343.     and.b    #$0f,d0
  344.     beq.s    mt_back
  345.     clr.l    mt_counter
  346.     move.b    d0,mt_cool+5
  347. mt_back:rts
  348.  
  349. mt_aud1temp:
  350.     blk.w    10,0
  351.     dc.w    $0001
  352.     blk.w    2,0
  353. mt_aud2temp:
  354.     blk.w    10,0
  355.     dc.w    $0002
  356.     blk.w    2,0
  357. mt_aud3temp:
  358.     blk.w    10,0
  359.     dc.w    $0004
  360.     blk.w    2,0
  361. mt_aud4temp:
  362.     blk.w    10,0
  363.     dc.w    $0008
  364.     blk.w    2,0
  365. mt_partnote:    dc.l    0
  366. mt_partnrplay:    dc.l    0
  367. mt_counter:    dc.l    0
  368. mt_partpoint:    dc.l    0
  369. mt_samples:dc.l    0
  370. mt_sample1:blk.l 15,0
  371. mt_maxpart:dc.w    $0000
  372. mt_dmacon:dc.w    $0000
  373. mt_status:dc.w    $0000
  374.  
  375. mt_arpeggio:
  376. dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c
  377. dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d
  378. dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0
  379. dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097
  380. dc.w $008f,$0087,$007f,$0078,$0071,$0000,$0000,$0000
  381.  
  382. mt_data:blk.b    0,0
  383.